apiVersion: route.openshift.io/v1
kind: Route
metadata:
{% if annotations is defined %}
  annotations:
    {{ annotations | to_nice_yaml | indent(4) }}
{% endif %}
  name: {{ routename }}
  labels:
    app: {{ app }}
spec:
{% if host is defined %}
  host: {{ host }}
{% endif %}
{% if path is defined %}
  path: {{ path }}
{% endif %}
{% if wildcardpolicy is defined %}
  wildcardPolicy: {{ wildcardpolicy }}
{% endif %}
  port:
    targetPort: {{ serviceport }}
  to:
    kind: Service
    name: {{ servicename }}
  tls:
{% if termination_passthrough is defined and termination_passthrough %}
    termination: Passthrough
{% elif termination_reencrypt is defined and termination_reencrypt %}
    termination: Reencrypt
{% else %}
    termination: edge
    insecureEdgeTerminationPolicy: Redirect
{% endif %}
